package com.lut.teacher.teacherservice.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lut.teacher.teacherservice.entity.TeacherInfoEntity;
import com.lut.teacher.teacherservice.entity.vo.TeacherInfoVo;
import com.lut.teacher.teacherservice.service.TeacherInfoService;
import com.lut.teacher.teacherservice.utils.PageUtils;
import com.lut.teacher.teacherservice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lut.teacher.teacherservice.entity.TeacherTitleEntity;
import com.lut.teacher.teacherservice.service.TeacherTitleService;



/**
 * 
 *
 * @author tongyerui
 * @email tongyerui@gmail.com
 * @date 2021-07-06 11:31:08
 */
@RestController
@RequestMapping("teacherservice/teachertitle")
public class TeacherTitleController {
    @Autowired
    private TeacherTitleService teacherTitleService;
    @Autowired
    private TeacherInfoService teacherInfoService;

    /**
     * 获取教师信息
     *
     */
    @RequestMapping("/teacher/info")
    public R teacherInfo(){
        List<TeacherInfoVo> list = teacherInfoService.queryteacher();


            return R.ok().put("data",list);
    }
    /**
     * 列表
     */
    @RequestMapping("/teacher/list")
    // @RequiresPermissions("teacherservice:teachertitle:list")
    public R teacherinfo(@RequestParam Map<String, Object> params){
        PageUtils page = teacherTitleService.queryinfo(params);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("teacherservice:teachertitle:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = teacherTitleService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("teacherservice:teachertitle:info")
    public R info(@PathVariable("id") Integer id){
		TeacherTitleEntity teacherTitle = teacherTitleService.getById(id);

        return R.ok().put("teacherTitle", teacherTitle);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("teacherservice:teachertitle:save")
    public R save(@RequestBody TeacherTitleEntity teacherTitle){
		teacherTitleService.save(teacherTitle);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("teacherservice:teachertitle:update")
    public R update(@RequestBody TeacherTitleEntity teacherTitle){
		teacherTitleService.updateById(teacherTitle);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("teacherservice:teachertitle:delete")
    public R delete(@RequestBody Integer[] ids){
		teacherTitleService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
